package com.jishaokang.controller;

import com.jishaokang.base.Result;
import com.jishaokang.model.dto.Chapter;
import com.jishaokang.model.dto.Message;
import com.jishaokang.model.dto.User;
import com.jishaokang.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by NANA_Final on 2019/6/21.
 */
@RestController
@RequestMapping(value = "/api")
public class MessageController {

    @Autowired
    private MessageService messageService;

    @RequestMapping(value = "/user/message/selectTotalUnreadMessage",method = RequestMethod.POST)
    public Result selectTotalUnreadMessage(@RequestBody Message message) {
        return messageService.selectTotalUnreadMessage(message);
    }

    @RequestMapping(value = "/user/message/selectMessageByReceiverId",method = RequestMethod.POST)
    public Result selectMessageByReceiverId(@RequestBody Message message) {
        return messageService.selectMessageByReceiverId(message);
    }

    @RequestMapping(value = "/user/message/selectMessageByMessageId",method = RequestMethod.POST)
    public Result selectMessageByMessageId(@RequestBody Message message) {
        return messageService.selectMessageByMessageId(message);
    }

    @RequestMapping(value = "/user/message/updateMessageStateByMessageId",method = RequestMethod.POST)
    public Result updateMessageStateByMessageId(@RequestBody Message message) {
        return messageService.updateMessageStateByMessageId(message);
    }

    @RequestMapping(value = "/user/message/deleteMessageByMessageId",method = RequestMethod.POST)
    public Result deleteMessageByMessageId(@RequestBody Message message) {
        return messageService.deleteMessageByMessageId(message);
    }

    @RequestMapping(value = "/user/message/updateMessagesStatesByReceiverId",method = RequestMethod.POST)
    public Result updateMessagesStatesByReceiverId(@RequestBody Message message) {
        return messageService.updateMessagesStatesByReceiverId(message);
    }

    @RequestMapping(value = "/user/message/deleteMessagesByReceiverIdAndState",method = RequestMethod.POST)
    public Result deleteMessagesByReceiverIdAndState(@RequestBody Message message) {
        return messageService.deleteMessagesByReceiverIdAndState(message);
    }

}